clear all
set more off


global version old_
 


use $data/cerved.dta, clear

keep codfisc  
gen C_FISCALE= codfisc 
duplicates drop
save $temp/codfiscCERVEDX.dta, replace
									

use ${data}/uninps.dta, clear
rename anno year
keep  year provIstat codfisc
tempfile provIstat_uninps
save `provIstat_uninps'

use  ${data}/invind.dta , clear
gen nu=   v558/10-1 
 collapse(mean) nu, by( sottosez)
 replace nu=-nu
 tempfile  nu_sottosez
  save `nu_sottosez'

use  ${data}/invind.dta , clear
 gen byte notnumeric = real(codf)==.
drop if notnumeric==1  

 destring codf, gen(codfisc)
 tostring codfisc, format(%016.0f) replace
 rename annoril year
merge 1:1 codfisc year using `provIstat_uninps', keep(3) nogen 
merge m:1  sottosez using `nu_sottosez', keep(3) nogen


drop if v285==1|v286==1|v287==1|v288==1|v289==1|v290==1 // |v536==1 
drop if sottosez=="CA" 
egen ateco=group(sottosez)
egen id=group(codfisc)
xtset id year


gen eps_s=(v210-L1.v437)/v209
gen eps_pi=(v220a-L1.v440)/100
gen eps_q=eps_s-eps_pi
gen eta=eps_s+(nu-1)*eps_pi  

gen eps_nprod=eps_q-(v24-L1.v611m)/v15
replace eps_nprod=eps_q-(v206-L1.v611)/v205 if eps_nprod==.
corr eta eps_nprod

egen dummy_st=group($sector year)
egen dummy_mt=group(provIstat year )
 reghdfe eta, absorb(id ateco##year provIstat##year) resid(eps_delta_res)
 
collapse(sd) sd_eps_delta_res_pt=eps_delta_res, by(provIstat year)

save ${temp}/sd_eps_delta_res_pt.dta, replace														
/**/



use ${data}/taxia, clear

gen int_cl=importo if voce==5506067
gen com_cl=importo if voce==5506068
gen nco_cl=importo if voce==5506061

gen int_tl=importo if voce==5504067
gen com_tl=importo if voce==5504068
gen nco_tl=importo if voce==5504061


gen int_au=importo if voce==5502067
gen com_au=importo if voce==5502068
gen nco_au=importo if voce==5502061



foreach x in ori res {
preserve 
if "`x'"=="ori"{
	replace durori_tasso=17 if durori_tasso==36 | durori_tasso==37
	collapse(sum) int_* com_* nco_*, by(provIstat  durori_tasso year)	
	rename durori_tasso maturity
}
if "`x'"=="res"{
	replace durata=0 if durata==3
	collapse(sum) int_* com_* nco_*, by(provIstat  durata year)	
	rename durata maturity
}

drop if provIstat==.
	reshape wide int_cl int_tl int_au nco_cl com_cl nco_au com_au  nco_tl com_tl, i(provIstat year) j(maturity)

gen r_cl_`x'=int_cl0*365/nco_cl0
gen r_tl_st_`x'=int_tl5*365/nco_tl5
gen r_tl_mt_`x'=int_tl16*365/nco_tl16
gen r_tl_lt_`x'=int_tl17*365/nco_tl17


gen R_cl_`x'=(int_cl0+com_cl0)*365/nco_cl0
gen R_tl_st_`x'=(int_tl5+com_tl5)*365/nco_tl5
gen R_tl_mt_`x'=(int_tl16+com_tl16)*365/nco_tl16
gen R_tl_lt_`x'=(int_tl17+com_tl17)*365/nco_tl17


save ${temp}/tassi_pvaff_`x', replace 	
restore
}
collapse (sum) int_* com_*  nco_*, by(codfisc year)

save $temp/taxia_firm_panel.dta, replace



use $data/ccr.dta, clear


gen npl=uti if  (sta_rap>=83&sta_rap<=89) | (sta_rap>=52&sta_rap<=53) | (sta_rap>=220&sta_rap<=225)
gen bad=uti if voce==551000 | voce==550800 | voce==551002
gen tl=uti if voce==550400 & npl==.
gen cl=uti if voce==550600 & npl==. 
gen g_bad=imp_gar if voce==551000 | voce==550800 | voce==551002
replace g_bad=uti if g_bad>uti& g_bad<.
gen g_npl=imp_gar if (sta_rap>=83&sta_rap<=89) | (sta_rap>=52&sta_rap<=53) | (sta_rap>=220&sta_rap<=225)
replace g_npl=uti if g_npl>uti& g_npl<.
gen g_tl=imp_gar if voce==550400 & npl==.
replace g_tl=uti if g_tl>uti& g_tl<.
gen g_cl=imp_gar if voce==550600 & npl==.
replace g_cl=uti if g_cl>uti& g_cl<. 

foreach x in res ori{
preserve 
if "`x'"=="res"{
collapse(sum) g_* npl tl cl bad, by(provIstat dur_res year  )
reshape wide g_* npl tl cl bad , i(provIstat year ) j(dur_res)
rename cl0 cl_res
rename tl5 st_tl_res
rename tl18 mt_lt_tl_res
rename g_tl5 g_st_tl_res
rename g_tl18 g_mt_lt_tl_res
}
if "`x'"=="ori"{
collapse(sum) g_* npl tl cl bad , by(provIstat durata year  )
reshape wide g_* npl tl cl bad , i(provIstat year ) j(durata)
rename cl0 cl_ori
rename tl5 st_tl_ori
rename tl16 mt_tl_ori
rename tl17 lt_tl_ori
rename g_tl5 g_st_tl_ori
rename g_tl16 g_mt_tl_ori
rename g_tl17 g_lt_tl_ori
}


egen g_npl_`x'=rowtotal(g_npl*)
egen g_bad_`x'=rowtotal(g_bad*)
egen g_cl_`x'=rowtotal(g_cl*)
egen npl_`x'=rowtotal(npl*)
egen bad_`x'=rowtotal(bad*)
//keep cl_`x' g_npl_`x' g_bad_`x' bad_`x' g_tl* g_cl_`x' npl_`x'  provIstat year




save ${temp}/loans_maturity_pvaff_`x'.dta, replace
restore 
}
collapse (sum) bad npl uti , by(codfisc year)
save $temp/ccr_firm_panel.dta, replace



use ${data}/uninps, clear
keep codfisc provIstat dip12 anno

egen id=group(codfisc )
bys id:egen totdip12=total(dip12)
drop if totdip12==0
drop totdip12
fillin id anno
//bysort id (y_cessazINPS): replace y_cessazINPS= y_cessazINPS[1] if missing(y_cessazINPS) 
bysort id (provIstat): replace provIstat= provIstat[1] if missing(provIstat) 
bys id (codfisc) : replace codfisc = codfisc[_N] if codfisc==""
xtset id anno
replace dip12=0 if dip12==.
foreach x of numlist 1/1{
gen lag`x'_dip=L`x'.dip12
gen lead`x'_dip=F`x'.dip12
replace lag`x'_dip=0 if lag`x'_dip==.
replace lead`x'_dip=0 if lead`x'_dip==.
}





gen pg=1 if codfisc!=""
bys id: egen maxyear=max(anno) if dip12>0&dip12<.
bys id: egen minyear=min(anno) if dip12>0&dip12<.
bys id: egen maxyear2=min(maxyear)
bys id: egen minyear2=min(minyear)


drop if anno<minyear2 | anno>maxyear2



drop maxyear minyear
gen statusentry="en0" if /*dip12>0 & lag1_dip12==0 &*/ anno==minyear2 & anno>=1991
gen  statusexit="ex0" if /*dip12==0 & lag1_dip12>0 &*/ anno==maxyear2 & anno<2020 


gen age="age0" if statusentry=="en0"
foreach x of numlist 1/16{
//replace statusexit="ex`x'" if lag1_dip>0& anno==maxyear2+1-`x' & anno<=2020-`x'
replace age="age`x'" if  anno==minyear2+`x' & anno>=1991 +`x' & anno<=maxyear2 
}
//replace statusexit="ex19" if  statusexit=="" &  anno<=2020-12
gen diff=anno-minyear2
replace age="age17" if age=="" & diff>=17&diff<. & anno<=maxyear2

drop if age==""
gen en=(statusentry=="en0") 
gen nfirms_=1
gen ex=(statusexit=="ex0")
sort id anno
gen dip_ex_=dip12 if ex==1

rename dip12 dip_
rename lag1_dip lag_dip_


preserve 
collapse(sum) nfirms_  nfirms_ex_=ex  dip_ex_  dip_ lag_dip_ , by(anno age provIstat  )
reshape wide nfirms_ nfirms_ex_ dip_ex_  dip_ lag_dip_, i(anno provIstat ) j(age) string
rename anno year

save $temp/nfirm_xx.dta, replace
restore

 
 
 
preserve
gen year=anno
merge m:1 codfisc using $temp/codfiscCERVEDX.dta, keep(3) nogen
merge 1:1 codfisc anno using $data/cerved.dta, keep(1 3) nogen
merge 1:1 codfisc year using $temp/ccr_firm_panel.dta, keep(1 3) nogen
gen balancepanel=(age=="age17" & anno==2017)
bys codfisc: egen bp=total(balancepanel)
keep if bp==1
keep if anno>=2000
gen nfirms_cebp_=1
drop if age==""
rename dip_ dip_cebp_
gen va_cebp_=value_added_op
gen debtf_a=debfin-debban
egen DEBT_cebp_=rowtotal(utilizzato debtf_a)

collapse(sum)  va_cebp_  nfirms_cebp_   dip_cebp_ DEBT_cebp_ , by(anno age provIstat  )
drop if anno>2017
reshape wide  va_cebp_   nfirms_cebp_  dip_cebp_ DEBT_cebp_  , i(anno provIstat ) j(age) string
rename anno year

save ${temp}/nfirm_cebp_xx.dta, replace
restore


preserve

local var1 cau_death C_FISCALE y_morte
use `var1' using  $data/infoc_panel_rich.dta, clear
keep if inlist(cau_death ,"CF", "FA", "FL")
keep  C_FISCALE  y_morte
duplicates drop
rename (C_FISCALE y_morte) (codfisc year_bankruptcy)


save ${temp}/bankruptcy.dta, replace  
restore


preserve
merge m:1 codfisc using $temp/bankruptcy.dta, keep(1 3) nogen
rename anno year
merge 1:1 codfisc year using $temp/ccr_firm_panel.dta, keep(1 3) nogen
gen nfirms_pg_=1
sort id year
gen insolvent_strict=1 if ex==1 & (year_bankruptcy<. | (bad<. & bad>0) )
drop if age==""
collapse(sum) nfirms_pg_  nfirms_pg_ex_=ex   nfirms_pg_ins_=insolvent_strict  , by(year age provIstat  )
reshape wide  nfirms_pg_ nfirms_pg_ex_  nfirms_pg_ins_ , i(year provIstat ) j(age) string

save ${temp}/nfirm_pg_xx.dta, replace
restore


preserve
gen year=anno
merge m:1 codfisc using $temp/codfiscCERVEDX.dta, keep(3) nogen
merge 1:1 codfisc anno using $data/cerved.dta, keep(1 3) nogen
merge m:1 codfisc using $temp/bankruptcy.dta, keep(1 3) nogen
merge 1:1 codfisc year using $temp/ccr_firm_panel.dta, keep(1 3) nogen
merge 1:1 codfisc year using $temp/taxia_firm_panel.dta, keep(1 3) nogen
bys provIstat age anno: egen TOTdip_=total(dip_)
gen w=dip_/TOTdip_
 
g debt_ce_=utilizzato
gen insolvent_strict=1 if ex==1 & (year_bankruptcy<. | (bad<. & bad>0) )

gen debtf_a=debfin-debban
egen DEBT_ce_=rowtotal(utilizzato debtf_a)
keep if anno>=2000
gen nfirms_ce_=1
drop if age==""
gen lndebt_emp_ce_=ln(utilizzato/dip_)
gen lnDEBT_emp_ce_=ln(DEBT_ce_/dip_)
gen lnemp_ce_=ln(dip_)

gen lndebt_wemp_ce_=lndebt_emp_ce_ * w
gen lnDEBT_wemp_ce_=lnDEBT_emp_ce_ * w
gen lnwemp_ce_=lnemp_ce_ * w
gen lndebt_w2emp_ce_=lndebt_emp_ce_ * w * lndebt_emp_ce_
gen lnDEBT_w2emp_ce_=lnDEBT_emp_ce_ * w * lnDEBT_emp_ce_
gen lnw2emp_ce_=lnemp_ce_*w*lnemp_ce_

rename dip_ dip_ce_
gen va_ce_=value_added_op
collapse(sum)  lndebt_w2emp_ce_  lndebt_wemp_ce_  lnDEBT_w2emp_ce_ lnDEBT_wemp_ce_ lnw2emp_ce_ lnwemp_ce_ va_ce_  nfirms_ce_  debt_ce_ dip_ce_  nfirms_ce_ins_=insolvent_strict nfirms_ce_ex_=ex DEBT_ce_ int_cl com_cl int_tl com_tl int_au com_au nco_cl nco_tl nco_au , by(anno age provIstat  )

gen SD_lndebt_emp_ce_=(lndebt_w2emp_ce_ -lndebt_wemp_ce_*lndebt_wemp_ce)^.5 if anno>=2005 & anno<=2019
gen  SD_lnDEBT_emp_ce_=(lnDEBT_w2emp_ce_-lnDEBT_wemp_ce_*lnDEBT_wemp_ce_)^.5  if anno>=2005 & anno<=2019
gen SD_lnemp_ce_=(lnw2emp_ce_ - lnwemp_ce_*lnwemp_ce_)^.5 if anno>=2005 & anno<=2019
drop lndebt_w2emp_ce_ lnDEBT_w2emp_ce_ lnw2emp_ce_ lnwemp_ce_ lnDEBT_wemp_ce_ lndebt_wemp_ce



reshape wide  va_ce_  debt_ce_ nfirms_ce_  dip_ce_  nfirms_ce_ins_  nfirms_ce_ex_ DEBT_ce_ int_cl com_cl int_tl com_tl int_au com_au nco_cl nco_tl nco_au SD_lndebt_emp_ce_  SD_lnDEBT_emp_ce_ SD_lnemp_ce_, i(anno provIstat ) j(age) string
rename anno year
foreach x of numlist 0/17{
gen R_cl_ce_age`x'=(int_clage`x'+com_clage`x')*365/nco_clage`x'
gen R_ce_age`x'=(int_clage`x'+com_clage`x'+int_tlage`x'+com_tlage`x'+int_auage`x'+com_auage`x')*365/(nco_clage`x'+nco_tlage`x'+nco_auage`x')
}

drop int* nco*
save ${temp}/nfirm_ce_xx.dta, replace
restore



************************



use ${data}/uninps.dta, clear

 keep codfisc provIstat dip12 anno
 merge m:1 codfisc using $temp/codfiscCERVEDX.dta, keep(3) nogen

egen id=group(codfisc )

bys id:egen totdip12=total(dip12)
drop if totdip12==0
drop totdip12

bys id: egen minyear=min(anno) if dip12>0&dip12<.
bys id: egen minyear2=min(minyear)
bys id: egen maxyear=max(anno) if dip12>0&dip12<.
bys id: egen maxyear2=max(maxyear)
drop minyear maxyear


gen age=anno-minyear2 if minyear2>1990 
keep if age>=0

replace age=17 if (age>16 & age<.) | (minyear==1990 & anno>=2007)

drop if age==.
keep C_FISCALE anno age  provIstat minyear maxyear
save $temp/codfiscCERVEDXage.dta, replace
******/
/********/
use $temp/codfiscCERVEDXage.dta, clear
***************************************
keep if anno==minyear2 & anno>=2000
***************************************
//gen age="age0" 
gen codfisc =C_FISCALE
merge 1:1 codfisc anno using ${data}/uninps.dta, keep(3)
rename anno annoage0
keep C_FISCALE annoage0  provIstat ateco
save $temp/codfiscCERVEDXage0.dta, replace
******/





foreach x of numlist 2010/2021{
use $data/soci_SC_SP_`x'.dta, clear
gen annoage0=anno
merge m:1 C_FISCALE annoage0 using $temp/codfiscCERVEDXage0.dta, keep(3) nogen
collapse(sum) partecipazione (mean)  capsoc2 anno_nascita , by(C_FISCALE annoage0 provIstat id_socio)
gen quota=partecipazione/capsoc2
keep if quota<. & quota>0
bys id_socio: gen N=_N  
******************************************************

gen eta_socio_at_age0=annoage0-anno_nascita

gen RAS_55=(eta_socio_at_age0<56 )  // & N==1

foreach j in 55 {
	bys C_FISCALE RAS_`j': egen quota_RAS_`j'=total(quota) if RAS_`j'==1
}
********************************************************
keep RAS* C_FISCALE annoage0 provIstat quota_RAS* 
keep if RAS_55 ==1
duplicates drop
save $temp/RAS_firmage0_`x'.dta, replace
}

use $temp/RAS_firmage0_2010.dta, clear
foreach x of numlist 2011/2021{
append using	$temp/RAS_firmage0_`x'.dta
}
save $temp/RAS_firmage0_2010_21.dta, replace
foreach x of numlist 2011/2021{
erase $temp/RAS_firmage0_`x'.dta
}

foreach x in 55 {
	use $temp/RAS_firmage0_2010_21.dta, clear
	keep C_FISCALE anno* provIstat RAS_`x' quota_RAS_`x' 
	keep if RAS_`x'==1
	duplicates drop
	collapse (max) quota_RAS_`x', by(C_FISCALE anno* provIstat RAS_`x')
	save $temp/RAS_`x'_firmage0_2010_21.dta, replace
}
*****************


use ${data}/uninps, clear
	
if "$version"~="old_"{
****************************************************************************************************
gen crit1=1 if ateco== "01"|  ateco== "02"| ateco==  "45"| ateco==  "46"| ateco==  "47" | ateco== "68" | ateco==  "69"| ateco==  "84"| ateco==  "97"| ateco==  "98"| ateco==  "99"
drop if crit1==1
*****************************************************************************************************
}


keep codfisc  dip12 anno provIstat
egen id=group(codfisc )

bys id: egen maxyear=max(anno) if dip12>0&dip12<.
bys id: egen minyear=min(anno) if dip12>0&dip12<.
bys id: egen maxyear2=min(maxyear)
bys id: egen minyear2=min(minyear)





bys id:egen totdip12=total(dip12)
drop if totdip12==0
drop totdip12
fillin id anno
//bysort id (y_cessazINPS): replace y_cessazINPS= y_cessazINPS[1] if missing(y_cessazINPS) 
bysort id (provIstat): replace provIstat= provIstat[1] if missing(provIstat) 
bys id (codfisc) : replace codfisc = codfisc[_N] if codfisc==""
xtset id anno
replace dip12=0 if dip12==.
foreach x of numlist 1/1{
gen lag`x'_dip=L`x'.dip12
gen lead`x'_dip=F`x'.dip12
replace lag`x'_dip=0 if lag`x'_dip==.
replace lead`x'_dip=0 if lead`x'_dip==.
}





***************************************
drop if anno<minyear2 | anno>maxyear2
***************************************



drop maxyear minyear
gen statusentry="en0" if /*dip12>0 & lag1_dip12==0 &*/ anno==minyear2 & anno>=1991




gen  statusexit="ex0" if /*dip12==0 & lag1_dip12>0 &*/ anno==maxyear2 & anno<2021


gen age="age0" if statusentry=="en0"
foreach x of numlist 1/11{
//replace statusexit="ex`x'" if lag1_dip>0& anno==maxyear2+1-`x' & anno<=2020-`x'
replace age="age`x'" if  anno==minyear2+`x' & anno>=1991 +`x' & anno<=maxyear2 
}




foreach z in  55 {
preserve
rename codfisc C_FISCALE
merge m:1 C_FISCALE   using $temp/RAS_`z'_firmage0_2010_21.dta, keep(3) nogen
//merge m:1 C_FISCALE using $output/RAS_CF_anacredit_fondoPMI.dta, keep(3) nogen
rename C_FISCALE codfisc

if "$version"~="old_" {
keep if quota_RAS_`z'>=.66 & quota_RAS_`z'<=1 
}

merge 1:1 codfisc anno using $data/cerved.dta, keep(3) nogen
drop if age==""
keep if value_added_co<. & debfin<. & value_added_co>0 
//replace value_added_co=value_added_op
gen ${version}RAS_`z'_va_=value_added_co
gen  ${version}RAS_`z'_va2_=value_added_op
gen  ${version}RAS_`z'_va3_=value_production
gen  ${version}RAS_`z'_mol_=mol
gen  ${version}RAS_`z'_den_=den
gen  ${version}RAS_`z'_debban_=debban


sort id anno
gen  ${version}RAS_`z'_debfin_=debfin

//rename occ_tot RAS_`z'_dipxva_
rename dip12  ${version}RAS_`z'_dipxva_

collapse(sum)  ${version}RAS_`z'_debfin_  ${version}RAS_`z'_va_  ${version}RAS_`z'_va2_  ///
${version}RAS_`z'_va3_  ${version}RAS_`z'_dipxva_  , by(anno age provIstat  )
reshape wide  ${version}RAS_`z'_debfin_  ${version}RAS_`z'_va_  ${version}RAS_`z'_va2_  ///
${version}RAS_`z'_va3_  ${version}RAS_`z'_dipxva_  , i(anno provIstat ) j(age) string
rename anno year


save ${temp}/nfirm_${version}RAS_`z'_firmage0_va_debfin.dta, replace
restore
}


foreach z in  55 {
preserve
rename codfisc C_FISCALE
merge m:1 C_FISCALE   using $temp/RAS_`z'_firmage0_2010_21.dta, keep(3) nogen
rename C_FISCALE codfisc
if "$version"~="old_"{
keep if quota_RAS_`z'>=.66 & quota_RAS_`z'<=1 
}
drop if age==""
gen en=(statusentry=="en0") 
gen ${version}RAS_`z'_nfirms_=1
gen ex=(statusexit=="ex0")
sort id anno
gen ${version}RAS_`z'_dip_ex_=dip12 if ex==1

//br id anno age ex* minyear2 maxyear2 dip12 if minyear2==1990
rename dip12 ${version}RAS_`z'_dip_
rename lag1_dip ${version}RAS_`z'_lag_dip_
collapse(sum) ${version}RAS_`z'_nfirms_  ${version}RAS_`z'_nfirms_ex_=ex  ${version}RAS_`z'_dip_ex_  ${version}RAS_`z'_dip_ ${version}RAS_`z'_lag_dip_ , by(anno age provIstat  )
reshape wide ${version}RAS_`z'_nfirms_ ${version}RAS_`z'_nfirms_ex_ ${version}RAS_`z'_dip_ex_  ${version}RAS_`z'_dip_ ${version}RAS_`z'_lag_dip_, i(anno provIstat ) j(age) string
rename anno year

foreach x of numlist 0/11{
label var ${version}RAS_`z'_nfirms_age`x' "# of firms aged `x' w/ shareholder under `z' at age0 "
label var ${version}RAS_`z'_nfirms_ex_age`x' "# of firms aged `x' w/ shareholder under `z' at age0 (exits)"
label var ${version}RAS_`z'_dip_ex_age`x' "# of employees of firms aged `x' w/ shareholder under `z' at age0 (exits)"
label var ${version}RAS_`z'_dip_age`x' "# of employees of firms aged `x' w/ shareholder under `z' at age0"
label var ${version}RAS_`z'_lag_dip_age`x' "previous year # of employees of firms aged `x' w/ shareholder under `z' at age0"

	gen ${version}RAS_`z'_den_en`x'=(${version}RAS_`z'_dip_age`x'+${version}RAS_`z'_lag_dip_age`x')/2
}
save ${temp}/nfirm_${version}RAS_`z'_firmage0.dta, replace
restore
}








******************* merge all
use $data/va, clear
merge 1:1 provIstat year using $temp/sd_eps_delta_res_pt, nogen
merge 1:1 provIstat year using $temp/tassi_pvaff_ori, keep(1 3) nogen  
merge 1:1 provIstat year using $temp/tassi_pvaff_res, keep( 1 3) nogen 
merge 1:1 provIstat year using ${temp}/loans_maturity_pvaff_res.dta, keep( 1 3) nogen 
merge 1:1 provIstat year using ${temp}/loans_maturity_pvaff_ori.dta, keep( 1 3) nogen   
merge 1:1 provIstat year using $data/LFS_codpro.dta , nogen 
merge 1:1 provIstat year using $temp/nfirm_xx, nogen 
merge 1:1 provIstat year using $temp/nfirm_cebp_xx, nogen 
merge 1:1 provIstat year using $temp/nfirm_pg_xx, nogen //16_firms_entry_exit_pg.do [osiride/INPS]
merge 1:1 provIstat year using $temp/nfirm_ce_xx, nogen //18_firms_entry_exit_ce.do [osiride/INPS]
merge 1:1 provIstat year using ${temp}/nfirm_${version}RAS_55_firmage0.dta, nogen 
merge 1:1 provIstat year using ${temp}/nfirm_${version}RAS_55_firmage0_va_debfin.dta, nogen


merge m:1 provIstat using $data/province_codici, nogen


save "${data}/descriptive.dta", replace

